﻿//==============================================================================  
//Copyright (C) 2012-2015 9UN.ORG. All rights reserved. 
//GUID：46172595-6b69-4526-b9da-426d663f5b05
//CLR Version: 4.0.30319.18033
//Code Author：Kevin Wang
//Contact：Email(Admin@9un.org),QQ(265382 or 74344)
//Filename：MediaLibraryFactory
//Namespace：RuanRang.Media.Core
//Functions：MediaLibraryFactory  
//Created by Kevin Wang at 2013/2/2 23:05:09 http://blog.9un.org
//============================================================================== 

#region Usings

using System;
using System.Runtime.InteropServices;

#endregion

namespace RuanRang.Media.Core.Internal.DataStructures
{
    /// <summary>
    /// Represents libvlc-compatible structure of original log message.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct libvlc_log_message_t
    {
        /// <summary>
        /// Sizeof() of message structure, must be filled in by user.
        /// </summary>
        public UInt32 sizeof_msg;

        /// <summary>
        /// Severity code :
        /// 0=INFO, 1=ERR, 2=WARN, 3=DBG.
        /// </summary>
        private Int32 i_severity;

        /// <summary>
        /// Module type.
        /// </summary>
        private IntPtr psz_type;

        /// <summary>
        /// Module name.
        /// </summary>
        private IntPtr psz_name;

        /// <summary>
        /// Optional header.
        /// </summary>
        private IntPtr psz_header;

        /// <summary>
        /// Message.
        /// </summary>
        private IntPtr psz_message;

        /// <summary>
        /// Gets the severity.
        /// </summary>
        /// <value>The severity.</value>
        public libvlc_log_message_t_severity Severity
        {
            get
            {
                return (libvlc_log_message_t_severity)(i_severity);
            }
        }

        /// <summary>
        /// Gets the type.
        /// </summary>
        /// <value>The type.</value>
        public string Type
        {
            get
            {
                return (Marshal.PtrToStringAnsi(psz_type));
            }
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name
        {
            get
            {
                return (Marshal.PtrToStringAnsi(psz_name));
            }
        }

        /// <summary>
        /// Gets the header.
        /// </summary>
        /// <value>The header.</value>
        public string Header
        {
            get
            {
                return (Marshal.PtrToStringAnsi(psz_header));
            }
        }

        /// <summary>
        /// Gets the message.
        /// </summary>
        /// <value>The message.</value>
        public string Message
        {
            get
            {
                return (Marshal.PtrToStringAnsi(psz_message));
            }
        }
    }
}